import { defineStore } from 'pinia'
import { store } from '/@/store'
import type { AxiosResponse } from 'axios'
import type { Res } from '/@/tool/Res'
import type { Param } from '/@/tool/Param'
import type { DataExportAO } from '/@/model/cn/core/tool/ao/DataExportAO'

import taskExpressionSqlParamService from '/@/api/cn/core/kpis/taskExpressionSqlParamService'

import type { TaskExpressionSqlParam } from '/@/model/cn/core/kpis/eo/TaskExpressionSqlParam'
import type { TaskExpressionSqlParamQO } from '/@/model/cn/core/kpis/qo/TaskExpressionSqlParamQO'
import type { TaskExpressionSqlParamVO } from '/@/model/cn/core/kpis/vo/TaskExpressionSqlParamVO'

interface TaskExpressionSqlParamState {
}

export const useTaskExpressionSqlParamStore = defineStore({
  id: 'taskExpressionSqlParam',
  state: (): TaskExpressionSqlParamState => ({
  }),
  getters: {
  },
  actions: {
    save(param: Param<TaskExpressionSqlParam>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.save(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    saveBatch(param: Param<TaskExpressionSqlParam>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.saveBatch(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    update(param: Param<TaskExpressionSqlParam>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.update(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    updateBatch(param: Param<TaskExpressionSqlParam>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.updateBatch(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    remove(param: Param<TaskExpressionSqlParam>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.remove(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    removeBatch(param: Param<TaskExpressionSqlParam>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.removeBatch(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    count(param: Param<TaskExpressionSqlParamQO>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.count(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    pk(param: Param<TaskExpressionSqlParamQO>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.pk(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    query(param: Param<TaskExpressionSqlParamQO>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.query(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    paging(param: Param<TaskExpressionSqlParamQO>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.paging(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    countVo(param: Param<TaskExpressionSqlParamQO>): Promise<Res<TaskExpressionSqlParamVO>> {
      return new Promise<Res<TaskExpressionSqlParamVO>>((resolve, reject) => {
        taskExpressionSqlParamService.countVo(param).then((res: AxiosResponse<Res<TaskExpressionSqlParamVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    pkVo(param: Param<TaskExpressionSqlParamQO>): Promise<Res<TaskExpressionSqlParamVO>> {
      return new Promise<Res<TaskExpressionSqlParamVO>>((resolve, reject) => {
        taskExpressionSqlParamService.pkVo(param).then((res: AxiosResponse<Res<TaskExpressionSqlParamVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    queryVo(param: Param<TaskExpressionSqlParamQO>): Promise<Res<TaskExpressionSqlParamVO>> {
      return new Promise<Res<TaskExpressionSqlParamVO>>((resolve, reject) => {
        taskExpressionSqlParamService.queryVo(param).then((res: AxiosResponse<Res<TaskExpressionSqlParamVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    pagingVo(param: Param<TaskExpressionSqlParamQO>): Promise<Res<TaskExpressionSqlParamVO>> {
      return new Promise<Res<TaskExpressionSqlParamVO>>((resolve, reject) => {
        taskExpressionSqlParamService.pagingVo(param).then((res: AxiosResponse<Res<TaskExpressionSqlParamVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    dataImport(param: Param<string>): Promise<Res<TaskExpressionSqlParam>> {
      return new Promise<Res<TaskExpressionSqlParam>>((resolve, reject) => {
        taskExpressionSqlParamService.dataImport(param).then((res: AxiosResponse<Res<TaskExpressionSqlParam>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    dataExport(param: Param<DataExportAO<TaskExpressionSqlParamQO>>): Promise<Res<string>> {
      return new Promise<Res<string>>((resolve, reject) => {
        taskExpressionSqlParamService.dataExport(param).then((res: AxiosResponse<Res<string>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
  },
})

export function useTaskExpressionSqlParamStoreWithout() {
  return useTaskExpressionSqlParamStore(store)
}
